package com.bms.listener;

import java.sql.SQLException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.DoubleConverter;
import org.apache.commons.beanutils.converters.FloatConverter;
import org.apache.commons.beanutils.converters.IntegerConverter;

import com.bms.utils.JdbcUtil;

public class SystemInit implements ServletContextListener {

	public void contextInitialized(ServletContextEvent sce) {
		try {
			JdbcUtil.InitDataSource();
			ConvertUtils.register(new IntegerConverter(), java.lang.Integer.class);
			ConvertUtils.register(new FloatConverter(), java.lang.Float.class);
			ConvertUtils.register(new DoubleConverter(), java.lang.Double.class);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}

	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}
	
}
